<?php

namespace FrontModule;

class AkcniNabidkaPresenter extends FrontPresenter {

    public function renderDefault() {
        $tileTypeModel = new \AdminModule\Models\TileType($this->db);
        $types = $tileTypeModel->select('id_tile_type, section_title, unit')->order('order');
          
        $actions = array();
        foreach ($types as $key => $type) {
            $tileModel = new \AdminModule\Models\Tile($this->db);  
            $tiles = $tileModel->getActions($type->id_tile_type);
            if($tiles->count() > 0) {
                $actions[$key]['section_title'] = $type->section_title;
                $actions[$key]['unit'] = $type->unit;
                $actions[$key]['tiles'] = $tiles;
            }
        }
        
        $this->template->types = $actions;
    }

}
